package com.wuyou.designPatterns.decorator;

/**
 * SideBorder
 *
 * @Date 2024/9/26 14:12
 * @Author 无忧
 */
public class SideBorder extends Border{

    private char borderChar;

    /**
     * 在生成实例时通过参数指定被装饰物
     *
     * @param display
     */
    protected SideBorder(Display display, char ch) {
        super(display);
        this.borderChar = ch;
    }

    @Override
    public int getColumns() {
        return 1 + display.getColumns() + 1;
    }

    @Override
    public int getRows() {
        return display.getRows();
    }

    @Override
    public String getRowText(int row) {
        return borderChar + display.getRowText(row) + borderChar;
    }
}
